home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / capbowl.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  12KB  |  400 lines

  1. /***************************************************************************
  2.  
  3.   Coors Light Bowling/Bowl-O-Rama memory map
  4.  
  5.   driver by Zsolt Vasvari
  6.  
  7.   CPU Board:
  8.  
  9.   0000-3fff     3 Graphics ROMS mapped in using 0x4800 (Coors Light Bowling only)
  10.   0000-001f        Turbo board area (Bowl-O-Rama only) See Below.
  11.   4000          Display row selected
  12.   4800          Graphics ROM select
  13.   5000-57ff     Battery backed up RAM (Saves machine state after shut off)
  14.                 Enter setup menu by holding down the F2 key on the
  15.                 high score screen
  16.   5800-5fff        TMS34061 area
  17.  
  18.                 First 0x20 bytes of each row provide a 16 color palette for this
  19.                 row. 2 bytes per color: 0000RRRR GGGGBBBB.
  20.  
  21.                 Remaining 0xe0 bytes contain 2 pixels each for a total of
  22.                 448 pixels, but only 360 seem to be displayed.
  23.                 (Each row appears vertically because the monitor is rotated)
  24.  
  25.   6000          Sound command
  26.   6800            Trackball Reset. Double duties as a watchdog.
  27.   7000          Input port 1    Bit 0-3 Trackball Vertical Position
  28.                                   Bit 4   Player 2 Hook Left
  29.                                 Bit 5   Player 2 Hook Right
  30.                                 Bit 6   Upright/Cocktail DIP Switch
  31.                                 Bit 7   Coin 2
  32.   7800          Input port 2    Bit 0-3 Trackball Horizontal Positon
  33.                                 Bit 4   Player 1 Hook Left
  34.                                 Bit 5   Player 1 Hook Right
  35.                                 Bit 6   Start
  36.                                 Bit 7   Coin 1
  37.   8000-ffff        ROM
  38.  
  39.  
  40.   Sound Board:
  41.  
  42.   0000-07ff        RAM
  43.   1000-1001        YM2203
  44.                   Port A D7 Read  is ticket sensor
  45.                 Port B D7 Write is ticket dispenser enable
  46.                 Port B D6 looks like a diagnostics LED to indicate that
  47.                           the PCB is operating. It's pulsated by the
  48.                           sound CPU. It is kind of pointless to emulate it.
  49.   2000            Not hooked up according to the schematics
  50.   6000            DAC write
  51.   7000            Sound command read (0x34 is used to dispense a ticket)
  52.   8000-ffff        ROM
  53.  
  54.  
  55.   Turbo Board Layout (Plugs in place of GR0):
  56.  
  57.   Bowl-O-Rama    Copyright 1991 P&P Marketing
  58.                 Marquee says "EXIT Entertainment"
  59.  
  60.                 This portion: Mike Appolo with the help of Andrew Pines.
  61.                 Andrew was one of the game designers for Capcom Bowling,
  62.                 Coors Light Bowling, Strata Bowling, and Bowl-O-Rama.
  63.  
  64.                 This game was an upgrade for Capcom Bowling and included a
  65.                 "Turbo PCB" that had a GAL address decoder / data mask
  66.  
  67.   Memory Map for turbo board (where GR0 is on Capcom Bowling PCBs:
  68.  
  69.   0000           Read Mask
  70.   0001-0003        Unused
  71.   0004          Read Data
  72.   0005-0007        Unused
  73.   0008          GR Address High Byte (GR17-16)
  74.   0009-0016        Unused
  75.   0017            GR Address Middle Byte (GR15-0 written as a word to 0017-0018)
  76.   0018          GR address Low byte
  77.   0019-001f        Unused
  78.  
  79. ***************************************************************************/
  80.  
  81. #include "driver.h"
  82. #include "vidhrdw/generic.h"
  83. #include "vidhrdw/tms34061.h"
  84. #include "machine/ticket.h"
  85. #include "cpu/m6809/m6809.h"
  86.  
  87. void capbowl_init_machine(void);
  88.  
  89. void capbowl_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  90.  
  91. int  capbowl_vh_start(void);
  92. void capbowl_vh_stop(void);
  93.  
  94. extern unsigned char *capbowl_rowaddress;
  95.  
  96. WRITE_HANDLER( capbowl_rom_select_w );
  97.  
  98. READ_HANDLER( capbowl_pagedrom_r );
  99.  
  100. WRITE_HANDLER( bowlrama_turbo_w );
  101. READ_HANDLER( bowlrama_turbo_r );
  102.  
  103.  
  104.  
  105. static unsigned char *nvram;
  106. static size_t nvram_size;
  107.  
  108. static void nvram_handler(void *file,int read_or_write)
  109. {
  110.     if (read_or_write)
  111.         osd_fwrite(file,nvram,nvram_size);
  112.     else
  113.     {
  114.         if (file)
  115.             osd_fread(file,nvram,nvram_size);
  116.         else
  117.         {
  118.             /* invalidate nvram to make the game initialize it.
  119.                A 0xff fill will cause the game to malfunction, so we use a
  120.                0x01 fill which seems OK */
  121.             memset(nvram,0x01,nvram_size);
  122.         }
  123.     }
  124. }
  125.  
  126.  
  127. static WRITE_HANDLER( capbowl_sndcmd_w )
  128. {
  129.     cpu_cause_interrupt(1, M6809_INT_IRQ);
  130.  
  131.     soundlatch_w(offset, data);
  132. }
  133.  
  134.  
  135. /* Handler called by the 2203 emulator when the internal timers cause an IRQ */
  136. static void firqhandler(int irq)
  137. {
  138.     cpu_set_irq_line(1,1,irq ? ASSERT_LINE : CLEAR_LINE);
  139. }
  140.  
  141.  
  142. /***************************************************************************
  143.  
  144.   NMI is to trigger the self test. We use a fake input port to tie that
  145.   event to a keypress.
  146.  
  147. ***************************************************************************/
  148. static int capbowl_interrupt(void)
  149. {
  150.     if (readinputport(4) & 1)    /* get status of the F2 key */
  151.         return nmi_interrupt();    /* trigger self test */
  152.  
  153.     return ignore_interrupt();
  154. }
  155.  
  156.  
  157. static int track[2];
  158.  
  159. static READ_HANDLER( track_0_r )
  160. {
  161.     return (input_port_0_r(offset) & 0xf0) | ((input_port_2_r(offset) - track[0]) & 0x0f);
  162. }
  163.  
  164. static READ_HANDLER( track_1_r )
  165. {
  166.     return (input_port_1_r(offset) & 0xf0) | ((input_port_3_r(offset) - track[1]) & 0x0f);
  167. }
  168.  
  169. static WRITE_HANDLER( track_reset_w )
  170. {
  171.     /* reset the trackball counters */
  172.     track[0] = input_port_2_r(offset);
  173.     track[1] = input_port_3_r(offset);
  174.  
  175.     watchdog_reset_w(offset,data);
  176. }
  177.  
  178.  
  179.  
  180. static struct MemoryReadAddress capbowl_readmem[] =
  181. {
  182.     { 0x0000, 0x3fff, MRA_BANK1 },
  183.     { 0x5000, 0x57ff, MRA_RAM },
  184.     { 0x5800, 0x5fff, TMS34061_r },
  185.     { 0x7000, 0x7000, track_0_r },    /* + other inputs */
  186.     { 0x7800, 0x7800, track_1_r },    /* + other inputs */
  187.     { 0x8000, 0xffff, MRA_ROM },
  188.     { -1 }  /* end of table */
  189. };
  190.  
  191. static struct MemoryReadAddress bowlrama_readmem[] =
  192. {
  193.     { 0x0000, 0x001f, bowlrama_turbo_r },
  194.     { 0x5000, 0x57ff, MRA_RAM },
  195.     { 0x5800, 0x5fff, TMS34061_r },
  196.     { 0x7000, 0x7000, track_0_r },    /* + other inputs */
  197.     { 0x7800, 0x7800, track_1_r },    /* + other inputs */
  198.     { 0x8000, 0xffff, MRA_ROM },
  199.     { -1 }  /* end of table */
  200. };
  201.  
  202. static struct MemoryWriteAddress writemem[] =
  203. {
  204.     { 0x0000, 0x001f, bowlrama_turbo_w },    /* Bowl-O-Rama only */
  205.     { 0x4000, 0x4000, MWA_RAM, &capbowl_rowaddress },
  206.     { 0x4800, 0x4800, capbowl_rom_select_w },
  207.     { 0x5000, 0x57ff, MWA_RAM, &nvram, &nvram_size },
  208.     { 0x5800, 0x5fff, TMS34061_w },
  209.     { 0x6000, 0x6000, capbowl_sndcmd_w },
  210.     { 0x6800, 0x6800, track_reset_w },    /* + watchdog */
  211.     { -1 }  /* end of table */
  212. };
  213.  
  214.  
  215. static struct MemoryReadAddress sound_readmem[] =
  216. {
  217.     { 0x0000, 0x07ff, MRA_RAM },
  218.     { 0x1000, 0x1000, YM2203_status_port_0_r },
  219.     { 0x1001, 0x1001, YM2203_read_port_0_r },
  220.     { 0x7000, 0x7000, soundlatch_r },
  221.     { 0x8000, 0xffff, MRA_ROM },
  222.     { -1 }  /* end of table */
  223. };
  224.  
  225. static struct MemoryWriteAddress sound_writemem[] =
  226. {
  227.     { 0x0000, 0x07ff, MWA_RAM},
  228.     { 0x1000, 0x1000, YM2203_control_port_0_w },
  229.     { 0x1001, 0x1001, YM2203_write_port_0_w },
  230.     { 0x2000, 0x2000, MWA_NOP },  /* Not hooked up according to the schematics */
  231.     { 0x6000, 0x6000, DAC_0_data_w },
  232.     { -1 }  /* end of table */
  233. };
  234.  
  235.  
  236.  
  237. INPUT_PORTS_START( capbowl )
  238.     PORT_START    /* IN0 */
  239.     /* low 4 bits are for the trackball */
  240.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  241.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  242.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) /* This version of Bowl-O-Rama */
  243.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )               /* is Upright only */
  244.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  245.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  246.  
  247.     PORT_START    /* IN1 */
  248.     /* low 4 bits are for the trackball */
  249.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  250.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  251.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  252.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  253.  
  254.     PORT_START    /* FAKE */
  255.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE, 20, 40, 0, 0 )
  256.  
  257.     PORT_START    /* FAKE */
  258.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X, 20, 40, 0, 0 )
  259.  
  260.     PORT_START    /* FAKE */
  261.     /* This fake input port is used to get the status of the F2 key, */
  262.     /* and activate the test mode, which is triggered by a NMI */
  263.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  264. INPUT_PORTS_END
  265.  
  266.  
  267.  
  268. static struct YM2203interface ym2203_interface =
  269. {
  270.     1,            /* 1 chip */
  271.     4000000,    /* 4 MHz */
  272.     { YM2203_VOL(40,40) },
  273.     { ticket_dispenser_r },
  274.     { 0 },
  275.     { 0 },
  276.     { ticket_dispenser_w },  /* Also a status LED. See memory map above */
  277.     { firqhandler }
  278. };
  279.  
  280. static struct DACinterface dac_interface =
  281. {
  282.     1,
  283.     { 100 }
  284. };
  285.  
  286.  
  287. #define MACHINEDRIVER(NAME, VISIBLE_Y)                        \
  288.                                                             \
  289. static struct MachineDriver machine_driver_##NAME =            \
  290. {                                                            \
  291.     /* basic machine hardware */                               \
  292.     {                                                        \
  293.         {                                                    \
  294.             CPU_M6809,                                        \
  295.             2000000,        /* 2 Mhz */                        \
  296.             NAME##_readmem,writemem,0,0,                    \
  297.             capbowl_interrupt, 1,       /* To check Service mode status */ \
  298.         },                                                    \
  299.         {                                                    \
  300.             CPU_M6809 | CPU_AUDIO_CPU,                        \
  301.             2000000,        /* 2 Mhz */                        \
  302.             sound_readmem,sound_writemem,0,0,                \
  303.             ignore_interrupt,1    /* interrupts are generated by the sound hardware */ \
  304.         }                                                    \
  305.     },                                                        \
  306.     57, 5000,    /* frames per second, vblank duration (guess) */ \
  307.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */ \
  308.     capbowl_init_machine,                                    \
  309.                                                             \
  310.     /* video hardware */                                    \
  311.     360, 256, { 0, 359, 0, VISIBLE_Y },                        \
  312.     0,                                                        \
  313.     16*256,16*256,                                            \
  314.     0,                                                        \
  315.                                                             \
  316.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,                \
  317.     0,                                                        \
  318.     capbowl_vh_start,                                        \
  319.     capbowl_vh_stop,                                        \
  320.     capbowl_vh_screenrefresh,                                \
  321.                                                             \
  322.     /* sound hardware */                                    \
  323.     0,0,0,0,                                                \
  324.     {                                                        \
  325.         {                                                    \
  326.             SOUND_YM2203,                                    \
  327.             &ym2203_interface                                \
  328.         },                                                    \
  329.         {                                                    \
  330.             SOUND_DAC,                                        \
  331.             &dac_interface                                    \
  332.         }                                                    \
  333.     },                                                        \
  334.                                                             \
  335.     nvram_handler                                            \
  336. };
  337.  
  338.  
  339. MACHINEDRIVER(capbowl,  244)
  340.  
  341. MACHINEDRIVER(bowlrama, 239)
  342.  
  343.  
  344. /***************************************************************************
  345.  
  346.   Game driver(s)
  347.  
  348. ***************************************************************************/
  349.  
  350. ROM_START( capbowl )
  351.     ROM_REGION( 0x28000, REGION_CPU1 )   /* 160k for code and graphics */
  352.     ROM_LOAD( "u6",           0x08000, 0x8000, 0x14924c96 )
  353.     ROM_LOAD( "gr0",          0x10000, 0x8000, 0xef53ca7a )
  354.     ROM_LOAD( "gr1",          0x18000, 0x8000, 0x27ede6ce )
  355.     ROM_LOAD( "gr2",          0x20000, 0x8000, 0xe49238f4 )
  356.  
  357.     ROM_REGION( 0x10000, REGION_CPU2 )   /* 64k for sound */
  358.     ROM_LOAD( "sound",        0x8000, 0x8000, 0x8c9c3b8a )
  359. ROM_END
  360.  
  361. ROM_START( capbowl2 )
  362.     ROM_REGION( 0x28000, REGION_CPU1 )   /* 160k for code and graphics */
  363.     ROM_LOAD( "progrev3.u6",  0x08000, 0x8000, 0x9162934a )
  364.     ROM_LOAD( "gr0",          0x10000, 0x8000, 0xef53ca7a )
  365.     ROM_LOAD( "gr1",          0x18000, 0x8000, 0x27ede6ce )
  366.     ROM_LOAD( "gr2",          0x20000, 0x8000, 0xe49238f4 )
  367.  
  368.     ROM_REGION( 0x10000, REGION_CPU2 )   /* 64k for sound */
  369.     ROM_LOAD( "sound",        0x8000, 0x8000, 0x8c9c3b8a )
  370. ROM_END
  371.  
  372. ROM_START( clbowl )
  373.     ROM_REGION( 0x28000, REGION_CPU1 )   /* 160k for code and graphics */
  374.     ROM_LOAD( "u6.cl",        0x08000, 0x8000, 0x91e06bc4 )
  375.     ROM_LOAD( "gr0.cl",       0x10000, 0x8000, 0x899c8f15 )
  376.     ROM_LOAD( "gr1.cl",       0x18000, 0x8000, 0x0ac0dc4c )
  377.     ROM_LOAD( "gr2.cl",       0x20000, 0x8000, 0x251f5da5 )
  378.  
  379.     ROM_REGION( 0x10000, REGION_CPU2 )   /* 64k for sound */
  380.     ROM_LOAD( "sound.cl",     0x8000, 0x8000, 0x1eba501e )
  381. ROM_END
  382.  
  383. ROM_START( bowlrama )
  384.     ROM_REGION( 0x10000, REGION_CPU1 )      /* 64k for code */
  385.     ROM_LOAD( "u6",           0x08000, 0x08000, 0x7103ad55 )
  386.  
  387.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound */
  388.     ROM_LOAD( "u30",          0x8000, 0x8000, 0xf3168834 )
  389.  
  390.     ROM_REGION( 0x40000, REGION_GFX1 )     /* 256K for Graphics used at runtime */
  391.     ROM_LOAD( "ux7",          0x00000, 0x40000, 0x8727432a )
  392. ROM_END
  393.  
  394.  
  395.  
  396. GAME( 1988, capbowl,  0,       capbowl,  capbowl, 0, ROT270_16BIT, "Incredible Technologies", "Capcom Bowling (set 1)" )
  397. GAME( 1988, capbowl2, capbowl, capbowl,  capbowl, 0, ROT270_16BIT, "Incredible Technologies", "Capcom Bowling (set 2)" )
  398. GAME( 1989, clbowl,   capbowl, capbowl,  capbowl, 0, ROT270_16BIT, "Incredible Technologies", "Coors Light Bowling" )
  399. GAME( 1991, bowlrama, 0,       bowlrama, capbowl, 0, ROT270_16BIT, "P & P Marketing", "Bowl-O-Rama" )
  400.